home *** CD-ROM | disk | FTP | other *** search
- 100 'Term of Loan ("LOANTERM")
- 110 CLS
- 120 COLOR 0,15 : PRINT "Term of Loan" : COLOR 15,0
- 130 PRINT : PRINT
- 140 DEFDBL A-Z
- 150 DEFINT M-N
- 160 MONEYFMT$ = "$$##,###,###.##"
- 170 ' Let user enter data
- 180 PRINT "Do not enter dollar signs or commas"
- 190 PRINT
- 200 INPUT "Amount of loan: ", PNCPL
- 210 INPUT "Payment each period: ", PMT
- 220 INPUT "Number of payments per year: ", NPY
- 230 INPUT "Annual interest rate (in percent): ", AR
- 240 ' Check if payment too low
- 250 PR = AR / (100 * NPY)
- 260 IF PNCPL * PR > PMT THEN PRINT : PRINT "Payment will not amortize loan" : END
- 270 ' Find number of periods to repay loan
- 280 IF PR <> 0 THEN NUMPAYMENTS = INT (-LOG (1 - PR * PNCPL / PMT) / LOG (1 + PR) ) ELSE NUMPAYMENTS = INT (PNCPL / PMT)
- 290 ' Find balance remaining at end of term
- 300 EBALANCE = (1 + PR) ^ -NUMPAYMENTS - 1
- 310 IF PR <> 0 THEN EBALANCE= (EBALANCE * PMT / PR + PNCPL) * (1 + PR) ^ NUMPAYMENTS ELSE EBALANCE = PNCPL - NUMPAYMENTS * PMT
- 320 ' Print results
- 330 PRINT : PRINT
- 340 PRINT "Number of payments required:"; TAB(32); NUMPAYMENTS
- 350 PRINT "Ending balance: "; TAB(20);
- 360 PRINT USING MONEYFMT$; EBALANCE
- 370 END